<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>
<body>
  <script>
    // 该事件会在页面 URL 的 hash 值, 发生变化的时候触发
    window.onhashchange = function(){
      console.log('hash 值发生了变化....');
    }

  </script>
</body>
</html>